import * as echarts from 'echarts';
export const drawCircle = function(data,dom){
    echarts.init(dom).dispose();
    var myChart = echarts.init(dom);
    console.log(myChart)
    // 绘制图表
    
    var dataStyle = {
        normal: {
          label: {
            show: false,
          },
          labelLine: {
            show: false,
          },
          shadowBlur: 0,
          shadowColor: data.color,
        },
      };
      myChart.setOption({
        series: [
          {
            name: "第一个圆环",
            type: "pie",
            clockWise: true,
            radius: [70, 75],
            itemStyle: dataStyle,
            hoverAnimation: false,
            center: ["50%", "50%"],
            data: [
              {
                value: 25,
                label: {
                  normal: {
                    rich: {
                      a: {
                        color: "#333333",
                        align: "center",
                        fontSize: 20,
                        fontWeight: "bold",
                      },
                      b: {
                        color: "#ccc",
                        align: "center",
                        fontSize: 14,
                        lineHeight:12
                      },
                      c: {
                        color: "#ccc",
                        align: "center",
                        fontSize: 16,
                        lineHeight:12
                      },
                    },
                    formatter: function (params) {
                      return (
                        "{a|" +
                        params.value +
                        "个}\n\n" +
                        "{b|统计}" +
                        
                        "\n\n{c|增长2%}"
                      );
                    },
                    position: "center",
                    show: true,
                    textStyle: {
                      fontSize: "14",
                      fontWeight: "normal",
                      color: "#fff",
                    },
                  },
                },
                itemStyle: {
                  normal: {
                    color: data.color,
                    shadowColor: data.color,
                    shadowBlur: 0,
                  },
                },
              },
              {
                value: 75,
                name: "invisible",
                itemStyle: {
                  normal: {
                    color: "#eeeeee",
                  },
                  emphasis: {
                    color: "#eeeeee",
                  },
                },
              },
            ],
          }
        ],
      })
}
  